#ifndef VISIBILITYFORM_H
#define VISIBILITYFORM_H

#include <QWidget>
#include <QSerialPort>
#include "../../protocol/visibilityprotocol.h"

namespace Ui {
class VisibilityForm;
}

//能够连接串口，解析数据
class VisibilityForm : public QWidget
{
    Q_OBJECT

public:
    explicit VisibilityForm(QWidget *parent = nullptr);
    ~VisibilityForm();

signals:
    void Sig_DeviceVisibilityProtocol(protocol::VisibilityProtocol);

private:
    QSerialPort* m_port;
    QByteArray m_readBuffer;

    void formInit();
    bool openDevice(QString portName);
    void closeDevice();
    void resolveProtrocol(QByteArray protocol);
    //bool update


    Ui::VisibilityForm *ui;
    QString checkDevState(QString);
};

#endif // VISIBILITYFORM_H
